package com.cambright.lotusroot
{
	public class Component
	{
		internal function $invoke():void 
		{ 
			invoke(); 
		}
		
		internal function $dispose():void {
			dispose();
		}
		
		internal function $update():void
		{
			if(_enabled)
				update();
		}
		
		private var _started:Boolean = false;
		private var _enabled:Boolean = false;
		final public function get enabled():Boolean
		{
			return _enabled;
		}
		final public function set enabled(value:Boolean):void
		{
			if(enabled == value) return;
			_enabled = value;
			
			if(_enabled)
			{
				if(!_started)
				{
					start();
					_started = true;
				}
				enable();
			}
			else disable();
		}
		
		protected function invoke():void {}
		protected function start():void {}
		protected function enable():void {}
		protected function dispose():void {}
		protected function update():void {}
		protected function disable():void {}
	}
}